ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Rabbit_Female Class Reference

The rabbit female class. All special female behaviour is described here. More...

#include <Rabbit.h>

Inheritance diagram for Rabbit_Female:
Rabbit_Adult Rabbit_Base TAnimal TALMaSSObject

Public Member Functions

 Rabbit_Female (int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_age, int a_weightage, Rabbit_Warren *a_warren)
 Rabbit_Female constructor. More...
virtual ~Rabbit_Female (void)
 Rabbit_Female destructor. More...
virtual void Step (void)
 The female rabbit step code. More...
void AddYoung (Rabbit_Young *a_young)
 Add a young. More...
void OnYoungDeath (Rabbit_Young *a_young)
 Message on death of a young. More...
void Weaned (Rabbit_Young *a_young)
 Message on weaning of a young. More...
void SetMinKits (double a_num)
void SetMaxKits (double a_num)
int GetTotalOffspring ()
int GetTotalLitters ()
int GetLittersThisYear ()
- Public Member Functions inherited from Rabbit_Adult
 Rabbit_Adult (int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_age, int a_weightage, Rabbit_Warren *a_warren)
 Rabbit_Adult constructor. More...
virtual ~Rabbit_Adult ()
 Rabbit_Adult destructor. More...
TTypesOfRabbitSocialStatus GetSocialStatus (void)
 Return the dominance status. More...
void SetSocialStatus (TTypesOfRabbitSocialStatus a_status)
 Sets the dominance status. More...
void SetMate (Rabbit_Adult *a_mate)
 Set/unset mate status. More...
virtual Rabbit_AdultGetMate (void)
 Get mate pointer. More...
void OnMateFinishedDigging (Rabbit_Adult *a_mate)
 Action when a mate has finished digging a burrow. More...
void OnMateDead (Rabbit_Adult *a_mate)
 Set/unset mate status. More...
- Public Member Functions inherited from Rabbit_Base
TTypeOfRabbitState GetCurrentRState ()
void SetAge (int a_age)
 Set age method. More...
RabbitObjectTypes GetRabbitType (void)
 Get rabbit type. More...
int GetAge (void)
 Get age method. More...
void SetweightAge (int a_age)
 Set age method. More...
int GetweightAge (void)
 Get age method. More...
Rabbit_WarrenGetWarren (void)
 Get warren pointer. More...
void SetWarren (Rabbit_Warren *a_warren)
 Set the warren pointer. More...
bool GetHasBurrow (void)
 Get burrow status. More...
void SetHasBurrow (bool a_status)
 Set/unset burrow status. More...
void SetDigging (int a_days)
 Set number of days to dig. More...
int GetDigging ()
 Get number of days to dig. More...
APoint GetBornLocation ()
 Get location of birth. More...
 Rabbit_Base (int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, Rabbit_Warren *a_warren)
 Rabbit constructor. More...
virtual ~Rabbit_Base (void)
 Rabbit destructor. More...
virtual void BeginStep (void)
 The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep. More...
void OnFed (void)
 Signals food arrived today. More...
void OnMumDead (void)
 Signals death of mum. More...
void OnEvicted (void)
 Signals mum has a new litter to look after. More...
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
AnimalPosition SupplyPosition ()
APoint SupplyPoint ()
int SupplyPolygonRef ()
int Supply_m_Location_x ()
int Supply_m_Location_y ()
virtual void KillThis ()
virtual void CopyMyself ()
void SetX (int a_x)
void SetY (int a_y)
 TAnimal (int x, int y, Landscape *L)
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
virtual int WhatState ()
virtual void Dying ()
void CheckManagement (void)
void CheckManagementXY (int x, int y)
virtual bool OnFarmEvent (FarmToDo)
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
bool GetStepDone ()
 Returns the step done indicator flag. More...
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...

Protected Member Functions

virtual TTypeOfRabbitState st_EvaluateTerritory (void)
 Female Evaluate Territory Step. More...
virtual TTypeOfRabbitState st_UpdateBreedingStatus (void)
 Female reproductive update - handles oestrous, gestation, lactation and birth. More...
virtual TTypeOfRabbitState st_GiveBirth (void)
 Female give birth state. More...
virtual TTypeOfRabbitState st_Lactating (void)
 Female lactating state. More...
virtual TTypeOfRabbitState st_Gestating (void)
 Female gestating state. More...
virtual TTypeOfRabbitState st_Forage (void)
 Adult female forage behaviour. More...
virtual void st_Dying (void)
 Female dying state. More...
int CalcLitterSize (void)
 Calculates the litter size at birth. More...
virtual void InternalPesticideHandlingAndResponse ()
 Handles internal effects of pesticide exposure - reimplemented from base class. More...
virtual void GeneralEndocrineDisruptor (double)
 Handles internal effects of endocrine distrupter pesticide exposure.
- Protected Member Functions inherited from Rabbit_Adult
virtual void EndStep (void)
 The EndStep is the last 'part' of the timestep that an animal can behave in. More...
- Protected Member Functions inherited from Rabbit_Base
virtual void Explore (void)
 Exploration method. More...
bool MortalityTest (double a_prop)
 A simple probability based test. More...
bool WalkTo (int a_x, int a_y)
 Walks to a location from current location. More...
virtual void GeneralOrganoPhosphate (double)
 Handles internal effects of organophosphate pesticide exposure. More...
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...

Protected Attributes

bool m_pregnant
 Flag to indicate pregnancy. More...
bool m_lactating
 Flag to indicate lactating. More...
int m_gestationcounter
 Counter to record the number of days gestating. More...
Rabbit_Youngm_myLitter [20]
 Holds the current young (for lactation) More...
int m_myLitterSize
 Holds the current litter size. More...
int m_MyOffspring
 The total number of kits born to her. More...
int m_MyTotalLitters
 The number of litters produced. More...
vector< int > m_AnnualLitters
 The number of litters produced. More...
- Protected Attributes inherited from Rabbit_Adult
TTypesOfRabbitSocialStatus m_socialstatus
 Flag to record dominance status (0-4) More...
int m_lifespan
 The rabbit's alloted lifespan. More...
 Pointer to the mate if any. More...
- Protected Attributes inherited from Rabbit_Base
int m_Age
 The rabbit's age. More...
TTypeOfRabbitState m_CurrentRState
 Variable to record current behavioural state. More...
 This is a time saving pointer to the correct population manager object. More...
double m_MyMortChance
bool m_haveBurrow
 Flag to record burrow status. More...
 True if currently mated. More...
 Pointer to mum. More...
bool m_FedToday
 Flag for been fed today. More...
double m_weight
 The weight in g. More...
int m_weightAge
 A physiological age parameter, this is the growth age based on an optimal curve (if optimal conditions it will be the same as m_age) More...
int m_digging
 Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries to make one. More...
APoint m_born_location
 The x,y location at birth. More...
double m_pesticide_burden
 State variable used to hold the current body-burden of pesticide. More...
bool m_pesticideInfluenced1
 Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth).
- Protected Attributes inherited from TAnimal
int m_Location_x
int m_Location_y
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...

Static Protected Attributes

static double m_MinKitsNo = cfg_rabbitminkits.value()
 The minimum number of kits. More...
static double m_MaxKitsNo = cfg_rabbitmaxkits.value() - cfg_rabbitminkits.value()
 The maximum number of kits. More...

Additional Inherited Members

- Public Attributes inherited from Rabbit_Base
RabbitObjectTypes m_RabbitType
 The rabbits type. More...
- Static Public Attributes inherited from Rabbit_Base
static double m_dispersalmortperm = cfg_dispersalmortperm.value()
 The extra dispersal mortality per m travelled. More...
static double m_pesticidedegradationrate = cfg_rabbit_pesticidedegradationrate.value()
 State variable used to hold the daily degredation rate of the pesticide in the body. More...

Detailed Description

The rabbit female class. All special female behaviour is described here.

Constructor & Destructor Documentation

◆ Rabbit_Female()

Rabbit_Female::Rabbit_Female ( int  p_x,
int  p_y,
int  p_x2,
int  p_y2,
Landscape p_L,
Rabbit_Population_Manager p_NPM,
int  a_age,
int  a_weightage,
Rabbit_Warren a_warren 

Rabbit_Female constructor.

900  : Rabbit_Adult(p_x, p_y, p_x2, p_y2, p_L, p_NPM, a_age, a_weightage, a_warren)
901 {
903  if (a_warren != NULL) a_warren->RabbitProductionRecord(rob_Female, 1);
904  m_lactating = false;
905  m_pregnant = false;
906  m_gestationcounter = 0;
907  m_myLitterSize = 0;
908  m_MyOffspring = 0;
909  m_MyTotalLitters = 0;
910 #ifdef __RABBITDEBUG
911  if (m_myWarren != NULL) if (m_myWarren->IsMember(this)==false)
912  {
913  m_OurLandscape->Warn("Rabbit_Female::Rabbit_Female","not a member of our warren");
914  exit(1);
915  }
916 #endif
917 }
@ rob_Female
Definition: Rabbit.h:73
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
Rabbit_Adult(int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_age, int a_weightage, Rabbit_Warren *a_warren)
Rabbit_Adult constructor.
Definition: Rabbit.cpp:523
RabbitObjectTypes m_RabbitType
The rabbits type.
Definition: Rabbit.h:170
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189
int m_myLitterSize
Holds the current litter size.
Definition: Rabbit.h:497
int m_MyTotalLitters
The number of litters produced.
Definition: Rabbit.h:505
int m_MyOffspring
The total number of kits born to her.
Definition: Rabbit.h:503
bool m_pregnant
Flag to indicate pregnancy.
Definition: Rabbit.h:489
bool m_lactating
Flag to indicate lactating.
Definition: Rabbit.h:491
int m_gestationcounter
Counter to record the number of days gestating.
Definition: Rabbit.h:493
void RabbitProductionRecord(RabbitObjectTypes YoungType, int kits)
Stores data about production of rabbits throughout year.
Definition: Rabbit.h:582
bool IsMember(Rabbit_Base *a_rabbit)
Returns true if this rabbit belongs to the warren.
Definition: Rabbit.cpp:1996
Landscape * m_OurLandscape
Definition: PopulationManager.h:229

References Rabbit_Warren::IsMember(), m_gestationcounter, m_lactating, m_myLitterSize, m_MyOffspring, m_MyTotalLitters, Rabbit_Base::m_myWarren, TAnimal::m_OurLandscape, m_pregnant, Rabbit_Base::m_RabbitType, Rabbit_Warren::RabbitProductionRecord(), rob_Female, and Landscape::Warn().

◆ ~Rabbit_Female()

Rabbit_Female::~Rabbit_Female ( void  )

Rabbit_Female destructor.

921 {
922  ;
923 }

Member Function Documentation

◆ AddYoung()

void Rabbit_Female::AddYoung ( Rabbit_Young a_young)

Add a young.

455  {
456  m_myLitter[m_myLitterSize++] = a_young;
457  }
Rabbit_Young * m_myLitter[20]
Holds the current young (for lactation)
Definition: Rabbit.h:495

References m_myLitter, and m_myLitterSize.

◆ CalcLitterSize()

int Rabbit_Female::CalcLitterSize ( void  )

Calculates the litter size at birth.

This determines how many young are born in a litter. Litter sizes are 3-8 young, but what controls this is not yet implemented, currently the results are stochastic between these extremes. However, there appears to be no consensus in the literature about this. Larger females have more young, but survival seems also to be greater for individuals of smaller litters. Since this seems to balance out uniform variation and standardised subsequent survival have been implemented.

1256 {
1262  return int(floor(m_MinKitsNo + g_rand_uni() * m_MaxKitsNo));
1263 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
static double m_MinKitsNo
The minimum number of kits.
Definition: Rabbit.h:499
static double m_MaxKitsNo
The maximum number of kits.
Definition: Rabbit.h:501

References g_rand_uni, m_MaxKitsNo, and m_MinKitsNo.

Referenced by st_GiveBirth().

◆ GeneralEndocrineDisruptor()

void Rabbit_Female::GeneralEndocrineDisruptor ( double  )

Handles internal effects of endocrine distrupter pesticide exposure.

For rabbits, only the female responds to this type of pesticide

Reimplemented from Rabbit_Base.

1424  {
1428  // May also wish to specify certain gestation days for the effects here
1429  if (m_gestationcounter > 0) {
1430  m_pesticideInfluenced1 = true;
1431  }
1432 }
bool m_pesticideInfluenced1
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects u...
Definition: Rabbit.h:205

References m_gestationcounter, and Rabbit_Base::m_pesticideInfluenced1.

Referenced by InternalPesticideHandlingAndResponse().

◆ GetLittersThisYear()

int Rabbit_Female::GetLittersThisYear ( )
466  {
467  return static_cast<int>(m_AnnualLitters.size());
468  }
vector< int > m_AnnualLitters
The number of litters produced.
Definition: Rabbit.h:507

References m_AnnualLitters.

◆ GetTotalLitters()

int Rabbit_Female::GetTotalLitters ( )

◆ GetTotalOffspring()

int Rabbit_Female::GetTotalOffspring ( )

◆ InternalPesticideHandlingAndResponse()

void Rabbit_Female::InternalPesticideHandlingAndResponse ( )

Handles internal effects of pesticide exposure - reimplemented from base class.

This method is re-implemented ffrom Rabbit_Base for any class which has pesticide response behaviour. If the body burden exceeds the trigger then call pesticide-specific actions by dose

Reimplemented from Rabbit_Base.

1395  {
1401  double pesticideInternalConc = m_pesticide_burden / m_weight;
1403  if (pesticideInternalConc > cfg_RabbitPesticideResponse.value()) {
1404  switch (tp) {
1405  case ttop_NoPesticide:
1406  break;
1408  GeneralEndocrineDisruptor( pesticideInternalConc ); // Calls the EndocrineDisruptor action code
1409  break;
1410  case ttop_AcuteEffects:
1411  GeneralOrganoPhosphate( pesticideInternalConc ); // Calls the GeneralOrganophosphate action code
1412  break;
1413  default:
1414  g_msg->Warn( "Unknown pesticide type used in Rabbit_Female::InternalPesticideHandlingAndResponse() pesticide code ", int( tp ) );
1415  exit( 47 );
1416  }
1417  }
1418  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
1419 }
MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41
CfgFloat cfg_RabbitPesticideResponse("RABBIT_PESTICDERESPONSETHRESHOLD", CFG_CUSTOM, 0.00001)
Input variable. The threshold above which a rabbit will be killed if it ingests pesticide.
double value(void)
Definition: configurator.h:118
TTypesOfPesticide SupplyPesticideType(void)
Definition: landscape.h:433
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
double m_weight
The weight in g.
Definition: Rabbit.h:195
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: Rabbit.h:203
static double m_pesticidedegradationrate
State variable used to hold the daily degredation rate of the pesticide in the body.
Definition: Rabbit.h:174
virtual void GeneralOrganoPhosphate(double)
Handles internal effects of organophosphate pesticide exposure.
Definition: Rabbit.cpp:1438
virtual void GeneralEndocrineDisruptor(double)
Handles internal effects of endocrine distrupter pesticide exposure.
Definition: Rabbit.cpp:1424
Definition: landscape.h:66
@ ttop_NoPesticide
Definition: landscape.h:67
@ ttop_AcuteEffects
Definition: landscape.h:68
@ ttop_ReproductiveEffects
Definition: landscape.h:69

References cfg_RabbitPesticideResponse, g_msg, GeneralEndocrineDisruptor(), Rabbit_Base::GeneralOrganoPhosphate(), TAnimal::m_OurLandscape, Rabbit_Base::m_pesticide_burden, Rabbit_Base::m_pesticidedegradationrate, Rabbit_Base::m_weight, Landscape::SupplyPesticideType(), ttop_AcuteEffects, ttop_NoPesticide, ttop_ReproductiveEffects, CfgFloat::value(), and MapErrorMsg::Warn().

◆ OnYoungDeath()

void Rabbit_Female::OnYoungDeath ( Rabbit_Young a_young)

Message on death of a young.

If a young has died then it is removed from the litter list. If it is the last one, then lactation is stopped immediately.

1294 {
1298  for(int l=0; l<m_myLitterSize; l++)
1299  {
1300  if (m_myLitter[l] == a_young)
1301  {
1302  for (int n=l; n<m_myLitterSize; n++)
1303  {
1304  m_myLitter[n] = m_myLitter[n+1];
1305  }
1306  m_myLitter[--m_myLitterSize] = NULL;
1307  if (m_myLitterSize == 0) m_lactating = false;
1308  return;
1309  }
1310  }
1311  // If we get here there is an error
1312  m_OurLandscape->Warn("Rabbit_Female::OnYoungDeath","unknown litter member");
1313  exit(1);
1314 }

References m_lactating, m_myLitter, m_myLitterSize, TAnimal::m_OurLandscape, and Landscape::Warn().

Referenced by Rabbit_Young::EndStep(), and Rabbit_Young::st_Dying().

◆ SetMaxKits()

void Rabbit_Female::SetMaxKits ( double  a_num)
463 { m_MaxKitsNo = a_num; }

References m_MaxKitsNo.

Referenced by Rabbit_Population_Manager::AssignStaticVariables().

◆ SetMinKits()

void Rabbit_Female::SetMinKits ( double  a_num)
462 { m_MinKitsNo = a_num; }

References m_MinKitsNo.

Referenced by Rabbit_Population_Manager::AssignStaticVariables().

◆ st_Dying()

void Rabbit_Female::st_Dying ( void  )

Female dying state.

Female dying state. Needs to:

  • Tell any young
  • Pass the mantle of dominance on if they are dominant
  • Perform the adult dying actions

Reimplemented from Rabbit_Adult.

974 {
981  for(int l=0; l<m_myLitterSize; l++)
982  {
983  m_myLitter[l]->OnMumDead();
984  }
987  }
988  // Record our repro output if needed
991 }
CfgBool cfg_RabbitUseReproOutput
@ rabbit_socialstatus_dominant
Definition: Rabbit.h:115
bool value(void)
Definition: configurator.h:135
virtual void st_Dying(void)
Default dying state.
Definition: Rabbit.cpp:691
TTypesOfRabbitSocialStatus m_socialstatus
Flag to record dominance status (0-4)
Definition: Rabbit.h:405
void OnMumDead(void)
Signals death of mum.
Definition: Rabbit.h:280
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:181
void ReproOutputRecordOutput(Rabbit_Female *a_female)
Print reproductive record to file.
Definition: Rabbit_Population_Manager.cpp:888
void ChooseNewDominant(void)
Finds a subdominantfemale and promotes them to dominant.
Definition: Rabbit.cpp:1952

References cfg_RabbitUseReproOutput, Rabbit_Warren::ChooseNewDominant(), m_myLitter, m_myLitterSize, Rabbit_Base::m_myWarren, Rabbit_Base::m_OurPopulationManager, Rabbit_Adult::m_socialstatus, Rabbit_Base::OnMumDead(), rabbit_socialstatus_dominant, Rabbit_Population_Manager::ReproOutputRecordOutput(), Rabbit_Adult::st_Dying(), and CfgBool::value().

Referenced by Step().

◆ st_EvaluateTerritory()

TTypeOfRabbitState Rabbit_Female::st_EvaluateTerritory ( void  )

Female Evaluate Territory Step.

The next behavioural state. Legal returns are toRabbits_Foraging, toRabbits_UpdateBreedingStatus, and toRabbits_Die

The rabbit must evaluate her territory and decide if she will stay or leave. This decision is based on a number of criteria:

  1. An evaluation of the current mate status
  2. An evaluation of the current social status
  3. An evaluation of the current territory quality
  4. A comparison with potential areas explored nearby

Here we make the assumption that if suitable quality unoccupied territory is known to be available and the rabbit is not dominant, then it will move to set up a territory there. If none is avaible or known, then the rabbit will remain as subordinate as long as the current territory can support her. If she is forced out she must find a vacent place or will die. If she stays she may become dominant one day.

No mate so before anything else we need to evaluate our current warren for possibilities - could be vacant burrow or mate here for us. If no warren for some reason, then find one.

If an itinerant then she must find a warren. Finds the closest - NB this code should not often be used, so efficiency here has not been optimised

Next she moves there, and assesses whether she can join

If there is a free burrow then joining is certain. If the warren site is unoccupied then currently the rabbit will join it and start to dig. This behaviour might need to be altered later, if rabbits might not start up alone so easily.

If nothing doing locally the Rabbit will move if conditions elsewhere are better and is not dominant or mated:

  • If itinerent, possible free territory -> move
  • If a mate is possible in the new place -> move
  • If itinerent there is a chance of moving even if to nothing better
994  {
1008  // We need to manage our annual repro info
1009  int today = m_OurLandscape->SupplyGlobalDate();
1010  for (int l = static_cast<int>(m_AnnualLitters.size()-1); l >= 0; l--) {
1011  if (today - m_AnnualLitters[ l ] > 365) {
1012  m_AnnualLitters.erase( m_AnnualLitters.begin() + (l) );
1013  }
1014  }
1015 #ifdef __RABBITDEBUG
1016  if (m_myWarren != NULL)
1017  {
1018  if (m_myWarren->IsMember( this ) == false) {
1019  m_OurLandscape->Warn( "Rabbit_Female::st_EvaluateTerritory", "not a member of our warren" );
1020  exit( 1 );
1021  }
1022  }
1023 #endif
1025 #ifdef __RABBITDEBUG
1026  if (m_myMate != NULL) {
1027  int rubbish = 0;
1028  }
1029 #endif
1030  return toRabbits_UpdateBreedingStatus; // No need to check the rest we have it all
1031  }
1032  // Update breeding status needs StepDone == false, but otherwise we need to set StepDone here.
1033  m_StepDone = true;
1034  if (m_myMate != NULL) {
1035  return toRabbits_Foraging; // Must be digging a burrow
1036  }
1040  if (m_myWarren == NULL) {
1046  bool survived = WalkTo( aRW->Supply_m_Location_x(), aRW->Supply_m_Location_y() );
1047  if (!survived) return toRabbits_Die;
1048  if (aRW->IsFreeMale()) {
1049  aRW->JoinNMate( this, rob_Male );
1050  }
1055  else {
1056  int burrow = aRW->IsFreeBurrow();
1057  if (burrow == 1) {
1058  aRW->JoinNOccupy( this );
1059  }
1060  else
1061  if (burrow == 2) {
1062  aRW->OccupyWarren( this );
1063  }
1065  }
1066  return toRabbits_Foraging;
1067  }
1068  // We have a warren but no mate or burrow
1069  else if (m_myWarren->IsFreeMale()) {
1070  m_myWarren->Mate( this, rob_Male );
1071  }
1072  else if (m_myWarren->IsFreeBurrow() == 1) {
1074  SetDigging( -1 );
1076  SetHasBurrow( true );
1077  }
1078  else if (m_digging > 0) {
1079  return toRabbits_Foraging;
1080  }
1081  else
1088  {
1090  if (aWarren != NULL) {
1091  if (aWarren->IsFreeMale()) {
1092  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1093  if (!survived) return toRabbits_Die;
1094  m_myWarren->Leave( this );
1095  aWarren->JoinNMate( this, rob_Male );
1096  }
1097  else {
1098  int burrows = aWarren->IsFreeBurrow();
1099  if (burrows == 1) {
1100  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1101  if (!survived) return toRabbits_Die;
1102  m_myWarren->Leave( this );
1103  aWarren->JoinNOccupy( this );
1105  }
1106  else if (burrows == 2) {
1107  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1108  if (!survived) return toRabbits_Die;
1109  m_myWarren->Leave( this );
1110  aWarren->OccupyWarren( this );
1112  }
1113  else {
1114  // No room but we may need to move anyway
1115  double dispersalchance = m_myWarren->GetAvailableForage()/5.0;
1116  if (g_rand_uni() < dispersalchance) {
1117  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1118  if (!survived) return toRabbits_Die;
1119  m_myWarren->Leave( this );
1120  aWarren->Join( this );
1121  SetDigging( -1 );
1123  }
1124  }
1125  }
1126  }
1127  }
1128 #ifdef __RABBITDEBUG
1129  if (m_myWarren != NULL) if (m_myWarren->IsMember( this ) == false) {
1130  m_OurLandscape->Warn( "Rabbit_Female::st_EvaluateTerritory", "not a member of our warren" );
1131  exit( 1 );
1132  }
1133 #endif
1134  return toRabbits_Foraging; // Do it all again tomorrow
1135 }
@ rabbit_socialstatus_subdominant
Definition: Rabbit.h:114
@ rabbit_socialstatus_zero
Definition: Rabbit.h:112
@ rabbit_socialstatus_subordinate
Definition: Rabbit.h:113
@ rob_Male
Definition: Rabbit.h:72
@ toRabbits_UpdateBreedingStatus
Definition: Rabbit.h:94
@ toRabbits_Foraging
Definition: Rabbit.h:92
@ toRabbits_Die
Definition: Rabbit.h:96
long SupplyGlobalDate(void)
Definition: landscape.h:1621
Rabbit_Adult * m_myMate
Pointer to the mate if any.
Definition: Rabbit.h:409
void SetSocialStatus(TTypesOfRabbitSocialStatus a_status)
Sets the dominance status.
Definition: Rabbit.h:391
void SetDigging(int a_days)
Set number of days to dig.
Definition: Rabbit.h:250
void SetHasBurrow(bool a_status)
Set/unset burrow status.
Definition: Rabbit.h:246
int m_digging
Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries t...
Definition: Rabbit.h:199
bool WalkTo(int a_x, int a_y)
Walks to a location from current location.
Definition: Rabbit.cpp:205
Rabbit_Warren * FindClosestWarren(int a_x, int a_y, int a_rank)
Finds the closest warren as the crow flies.
Definition: Rabbit_Population_Manager.cpp:692
A class to describe the rabbits warren system.
Definition: Rabbit.h:519
int IsFreeBurrow(void)
Is there a vacent burrow?
Definition: Rabbit.cpp:2035
void OccupyBurrow()
a_rabbit occupies a free burrow
Definition: Rabbit.cpp:2077
bool IsFreeMale(void)
Returns true if there is a male with a burrow and no mate.
Definition: Rabbit.cpp:2014
void Mate(Rabbit_Adult *a_mate, RabbitObjectTypes rob_type)
Mate him with un-mated female/male with a burrow.
Definition: Rabbit.cpp:2169
void Join(Rabbit_Base *a_rabbit)
Adds this rabbit to the warren list.
Definition: Rabbit.cpp:2061
Rabbit_Warren * GetNetworkWarren(void)
Chooses a warren to evaluate based on distance.
Definition: Rabbit.cpp:1913
void JoinNOccupy(Rabbit_Adult *a_rabbit)
Adds this adult to the warren list and house them in a suitable burrow.
Definition: Rabbit.cpp:2091
void OccupyWarren(Rabbit_Adult *a_rabbit)
Adds the first rabbit to the warren list.
Definition: Rabbit.cpp:2083
double GetAvailableForage(void)
Returns the available forage realtive to rabbit numbers.
Definition: Rabbit.h:642
void Leave(Rabbit_Base *a_rabbit)
Remove this adult from the warren list.
Definition: Rabbit.cpp:2117
void JoinNMate(Rabbit_Adult *a_mate, RabbitObjectTypes rob_type)
Adds this rabbit to the warren list and mate him with un-mated female/male with a burrow.
Definition: Rabbit.cpp:2224
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_Location_y
Definition: PopulationManager.h:228
int Supply_m_Location_x()
Definition: PopulationManager.h:213
int m_Location_x
Definition: PopulationManager.h:225
int Supply_m_Location_y()
Definition: PopulationManager.h:216

References Rabbit_Population_Manager::FindClosestWarren(), g_rand_uni, Rabbit_Warren::GetAvailableForage(), Rabbit_Warren::GetNetworkWarren(), Rabbit_Warren::IsFreeBurrow(), Rabbit_Warren::IsFreeMale(), Rabbit_Warren::IsMember(), Rabbit_Warren::Join(), Rabbit_Warren::JoinNMate(), Rabbit_Warren::JoinNOccupy(), Rabbit_Warren::Leave(), m_AnnualLitters, Rabbit_Base::m_digging, TAnimal::m_Location_x, TAnimal::m_Location_y, Rabbit_Adult::m_myMate, Rabbit_Base::m_myWarren, TAnimal::m_OurLandscape, Rabbit_Base::m_OurPopulationManager, Rabbit_Adult::m_socialstatus, TALMaSSObject::m_StepDone, Rabbit_Warren::Mate(), Rabbit_Warren::OccupyBurrow(), Rabbit_Warren::OccupyWarren(), rabbit_socialstatus_subdominant, rabbit_socialstatus_subordinate, rabbit_socialstatus_zero, rob_Male, Rabbit_Base::SetDigging(), Rabbit_Base::SetHasBurrow(), Rabbit_Adult::SetSocialStatus(), TAnimal::Supply_m_Location_x(), TAnimal::Supply_m_Location_y(), Landscape::SupplyGlobalDate(), toRabbits_Die, toRabbits_Foraging, toRabbits_UpdateBreedingStatus, Rabbit_Base::WalkTo(), and Landscape::Warn().

Referenced by Step().

◆ st_Forage()

TTypeOfRabbitState Rabbit_Female::st_Forage ( void  )

Adult female forage behaviour.

This is a critical part of the pesticide handling code. The rabbit forages from the warren area and as a result picks up pesticide. Exactly how much pesticide is picked up depends on the assumptions regarding foraging behaviour. These can be altered int GetForagePesticide(), but the default assumption is that the rabbit will forage from all suitable forgage locations equally, and therefore will pick up an average dose based on the average concentration of residue in the forage areas (there is an alternative version that picks the maximum concentration). This is precalculated by the Rabbit_Warren in UpdatePesticide. The pesticide response code is placed in EndStep - this will determine direct mortality or set any necessary flags indicating pesticide effects later, e.g. for reproduction.

1183  {
1194 }
@ toRabbits_EvaluateTerritory
Definition: Rabbit.h:93
double GetForagePesticide(void)
Gets the current mean pesticide concentration per unit forage.
Definition: Rabbit.h:628

References Rabbit_Warren::GetForagePesticide(), Rabbit_Base::m_myWarren, Rabbit_Base::m_pesticide_burden, and toRabbits_EvaluateTerritory.

Referenced by Step().

◆ st_Gestating()

TTypeOfRabbitState Rabbit_Female::st_Gestating ( void  )

Female gestating state.

Updates gestation counter and if still lactating returns a suitable return state, unless its time to give birth.

1280 {
1285  if (m_gestationcounter >= 30) {
1286  return toRabbits_GiveBirth;
1287  }
1288  if (m_lactating) return toRabbits_Lactating;
1289  return toRabbits_Foraging;
1290 }
@ toRabbits_GiveBirth
Definition: Rabbit.h:90
@ toRabbits_Lactating
Definition: Rabbit.h:89

References m_gestationcounter, m_lactating, toRabbits_Foraging, toRabbits_GiveBirth, and toRabbits_Lactating.

Referenced by Step().

◆ st_GiveBirth()

TTypeOfRabbitState Rabbit_Female::st_GiveBirth ( void  )

Female give birth state.

Produces kits. If currently lactating then expels the current young. If it is the breeding season and she has a mate, then she becomes pregnant again immediately. Whether the pregancy is successful will depend on the social status. If social status is too low they cannot reproduce, sub dominant has % chance to reproduce. Reproduction will also depend on the current forage and density

1197  {
1203  if (m_myLitterSize > 0) {
1204  for (int l = 0; l < m_myLitterSize; l++) {
1205  m_myLitter[ l ]->OnEvicted();
1206  m_myLitter[ l ] = NULL;
1207  }
1208  m_myLitterSize = 0;
1209  }
1210  if (!m_pesticideInfluenced1) {
1211  // Here we take both social status and weight into account
1214  }
1215  int kits = 0;
1216  // Here we have a test for re-abosorption of the litter depending on forage conditions. Low forage high chance of re-absorption
1218  struct_Rabbit* sR = new struct_Rabbit;
1219  sR->m_age = 0;
1220  sR->m_L = m_OurLandscape;
1222  sR->m_x = m_Location_x;
1223  sR->m_y = m_Location_y;
1224  sR->m_x2 = m_Location_x;
1225  sR->m_y2 = m_Location_y;
1226  sR->m_Warren = m_myWarren;
1227  kits = CalcLitterSize();
1228  m_OurPopulationManager->CreateObjects( rob_Young, this, sR, kits );
1230  delete sR;
1231  }
1232  if (kits > 0) {
1233  m_lactating = true;
1234  // Record our success
1235  m_MyTotalLitters++;
1236  m_MyOffspring += kits;
1237  // We also need to manage our annual repro info
1239  }
1240  }
1241  else {
1242  m_pesticideInfluenced1 = false; // Reset the pesticide flag since we lost the litter
1244  }
1246  if (m_myMate != NULL) {
1247  m_pregnant = true;
1248  m_gestationcounter = 0;
1249  }
1250  }
1251  return toRabbits_Foraging;
1252 }
static CfgFloat cfg_rabbitsocialreproductionthreshold("RABBIT_SOCIALREPROTHRESHOLD", CFG_CUSTOM, 2.3)
The threshold at which social reproduction reduction is tested. 1.0 means 50% chance of reproduction ...
@ rob_Young
Definition: Rabbit.h:70
void OnEvicted(void)
Signals mum has a new litter to look after.
Definition: Rabbit.h:284
int m_weightAge
A physiological age parameter, this is the growth age based on an optimal curve (if optimal condition...
Definition: Rabbit.h:197
int CalcLitterSize(void)
Calculates the litter size at birth.
Definition: Rabbit.cpp:1255
void PesticideDeathRecord(RabbitObjectTypes ob_type)
Records pesticide poisoning incidents.
Definition: Rabbit_Population_Manager.cpp:768
void CreateObjects(RabbitObjectTypes ob_type, TAnimal *pvo, struct_Rabbit *a_data, int a_number)
Method for creating a new individual Rabbit.
Definition: Rabbit_Population_Manager.cpp:250
bool IsBreedingSeason(void)
Get whether it is breeding season.
Definition: Rabbit_Population_Manager.h:106
double GetLitterReabsortionConst(void)
Returns litter reabsorption chance.
Definition: Rabbit.h:650
Used for creation of a new Rabbit object.
Definition: Rabbit_Population_Manager.h:59
Rabbit_Population_Manager * m_NPM
Rabbit_Population_Manager pointer.
Definition: Rabbit_Population_Manager.h:72
int m_y
Definition: Rabbit_Population_Manager.h:64
int m_x2
x-coord of birth
Definition: Rabbit_Population_Manager.h:66
int m_age
The rabbit age.
Definition: Rabbit_Population_Manager.h:74
Rabbit_Warren * m_Warren
A pointer to the current warren.
Definition: Rabbit_Population_Manager.h:80
int m_y2
y-coord of birth
Definition: Rabbit_Population_Manager.h:68
Landscape * m_L
Landscape pointer.
Definition: Rabbit_Population_Manager.h:70
int m_x
Definition: Rabbit_Population_Manager.h:62

References CalcLitterSize(), cfg_rabbitsocialreproductionthreshold, Rabbit_Population_Manager::CreateObjects(), g_rand_uni, Rabbit_Warren::GetLitterReabsortionConst(), Rabbit_Population_Manager::IsBreedingSeason(), struct_Rabbit::m_age, m_AnnualLitters, m_gestationcounter, struct_Rabbit::m_L, m_lactating, TAnimal::m_Location_x, TAnimal::m_Location_y, m_myLitter, m_myLitterSize, Rabbit_Adult::m_myMate, m_MyOffspring, m_MyTotalLitters, Rabbit_Base::m_myWarren, struct_Rabbit::m_NPM, TAnimal::m_OurLandscape, Rabbit_Base::m_OurPopulationManager, Rabbit_Base::m_pesticideInfluenced1, m_pregnant, Rabbit_Adult::m_socialstatus, struct_Rabbit::m_Warren, Rabbit_Base::m_weightAge, struct_Rabbit::m_x, struct_Rabbit::m_x2, struct_Rabbit::m_y, struct_Rabbit::m_y2, Rabbit_Base::OnEvicted(), Rabbit_Population_Manager::PesticideDeathRecord(), rabbit_socialstatus_dominant, Rabbit_Warren::RabbitProductionRecord(), rob_Young, Landscape::SupplyGlobalDate(), toRabbits_Foraging, and CfgFloat::value().

Referenced by Step().

◆ st_Lactating()

TTypeOfRabbitState Rabbit_Female::st_Lactating ( void  )

Female lactating state.

Rotates round each of the current young and gives them milk. If this does not happen for some reason then the young will automatically die

1267 {
1271  for(int lit=0; lit<m_myLitterSize; lit++)
1272  {
1273  m_myLitter[lit]->OnFed();
1274  }
1275  return toRabbits_Foraging;
1276 }
void OnFed(void)
Signals food arrived today.
Definition: Rabbit.h:276

References m_myLitter, m_myLitterSize, Rabbit_Base::OnFed(), and toRabbits_Foraging.

Referenced by Step().

◆ st_UpdateBreedingStatus()

TTypeOfRabbitState Rabbit_Female::st_UpdateBreedingStatus ( void  )

Female reproductive update - handles oestrous, gestation, lactation and birth.

The repro behaviour to exhibit. Legal returns are: toRabbits_Gestation, toRabbits_GiveBirth, toRabbits_Lactating, toRabbits_Foraging

Determines where we are in the reproductive cycle. Will hold off or switch on oestrous depending upon season, otherwise will update gestation, continue lactating, mate or give birth as necessary. This uses a number of flags and counters specific to the female rabbit to achieve this. NB if she comes into oestrous and has a mate she will automatically become pregnant. Whether this will happen depends on the weather. Initially we assume that the average temperature over the last month determines intiation of breeding. Cessation may be more problematical. If lactating then the young are forced out at 30 days, when she can be giving birth again if it is still breeding season. If it is not breeding season and nothing else is happening then evaulate territory. This requires setting StepDone to true to prevent continuous looping.

1139 {
1152  {
1153  // Do we have a litter on the way?
1154  if (m_pregnant)
1155  {
1156  return toRabbits_Gestation;
1157  }
1158  else
1159  {
1160  // Not pregnant but breeding season so check if there is a mate.
1161  if (m_myMate != NULL)
1162  {
1163  m_pregnant = true;
1164  m_gestationcounter = 0;
1165  }
1166  else if (m_myWarren->IsFreeMale())
1167  {
1168  m_myWarren->Mate( this, rob_Male );
1169  }
1170  }
1171  return toRabbits_Foraging;
1172  }
1173  // Not breeding season but may have young
1174  if (m_lactating) return toRabbits_Lactating;
1175  else
1176  {
1177  m_gestationcounter = 0;
1178  return toRabbits_Foraging;
1179  }
1180 }
@ toRabbits_Gestation
Definition: Rabbit.h:88

References Rabbit_Population_Manager::IsBreedingSeason(), Rabbit_Warren::IsFreeMale(), m_gestationcounter, m_lactating, Rabbit_Adult::m_myMate, Rabbit_Base::m_myWarren, Rabbit_Base::m_OurPopulationManager, m_pregnant, Rabbit_Warren::Mate(), rob_Male, toRabbits_Foraging, toRabbits_Gestation, and toRabbits_Lactating.

Referenced by Step().

◆ Step()

void Rabbit_Female::Step ( void  )

The female rabbit step code.

The female step code is the most complicated of the rabbit behavioural control. It is very similar to the male's code but with the addition of the behaviours related to reproduction. Each day the cycle involves an evaluation of the current resource status, and then updating the reproductive behaviour. Exactly which behaviour needs to be updated depends on the current status and whether it is breeding season, and of course whether there is a mate.

Reimplemented from Rabbit_Base.

927 {
933  if (m_StepDone || m_CurrentStateNo == -1) return;
934  switch (m_CurrentRState)
935  {
936  case toRabbits_InitialState: // Initial state always starts with develop
938  break;
939  case toRabbits_Foraging:
941  m_StepDone = true;
942  break;
943  case toRabbits_EvaluateTerritory: // Initial state always starts with develop
945  break;
948  break;
949  case toRabbits_Gestation:
951  break;
952  case toRabbits_GiveBirth:
954  break;
955  case toRabbits_Lactating:
957  break;
958  case toRabbits_Die:
959  st_Dying(); // No return value - no behaviour after this
960  m_StepDone=true;
961  break;
962  case toRabbits_Remove:
963  m_CurrentStateNo = -1;
964  m_StepDone=true;
965  break;
966  default:
967  m_OurLandscape->Warn("Rabbit_Female::Step()","unknown state - default");
968  exit(1);
969  }
970 }
@ toRabbits_Remove
Definition: Rabbit.h:95
@ toRabbits_InitialState
Definition: Rabbit.h:84
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
virtual TTypeOfRabbitState st_Gestating(void)
Female gestating state.
Definition: Rabbit.cpp:1279
virtual TTypeOfRabbitState st_GiveBirth(void)
Female give birth state.
Definition: Rabbit.cpp:1197
virtual void st_Dying(void)
Female dying state.
Definition: Rabbit.cpp:973
virtual TTypeOfRabbitState st_Lactating(void)
Female lactating state.
Definition: Rabbit.cpp:1266
virtual TTypeOfRabbitState st_Forage(void)
Adult female forage behaviour.
Definition: Rabbit.cpp:1183
virtual TTypeOfRabbitState st_EvaluateTerritory(void)
Female Evaluate Territory Step.
Definition: Rabbit.cpp:994
virtual TTypeOfRabbitState st_UpdateBreedingStatus(void)
Female reproductive update - handles oestrous, gestation, lactation and birth.
Definition: Rabbit.cpp:1138
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116

References Rabbit_Base::m_CurrentRState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, st_Dying(), st_EvaluateTerritory(), st_Forage(), st_Gestating(), st_GiveBirth(), st_Lactating(), st_UpdateBreedingStatus(), toRabbits_Die, toRabbits_EvaluateTerritory, toRabbits_Foraging, toRabbits_Gestation, toRabbits_GiveBirth, toRabbits_InitialState, toRabbits_Lactating, toRabbits_Remove, toRabbits_UpdateBreedingStatus, and Landscape::Warn().

◆ Weaned()

void Rabbit_Female::Weaned ( Rabbit_Young a_young)

Message on weaning of a young.

If a young has been weaned then it is removed from the litter list. If it is the last one, then lactation is stopped immediately.

1318 {
1322  for(int l=0; l<m_myLitterSize; l++)
1323  {
1324  if (m_myLitter[l] == a_young)
1325  {
1326  for (int n=l; n<m_myLitterSize; n++)
1327  {
1328  m_myLitter[n] = m_myLitter[n+1];
1329  }
1330  m_myLitter[--m_myLitterSize] = NULL;
1331  if (m_myLitterSize == 0) m_lactating = false;
1332  return;
1333  }
1334  }
1335  // If we get here there is an error
1336  m_OurLandscape->Warn("Rabbit_Female::Weaned","unknown litter member");
1337  exit(1);
1338 }

References m_lactating, m_myLitter, m_myLitterSize, TAnimal::m_OurLandscape, and Landscape::Warn().

Referenced by Rabbit_Young::st_BecomeJuvenile().

Member Data Documentation

◆ m_AnnualLitters

vector<int> Rabbit_Female::m_AnnualLitters

The number of litters produced.

Referenced by GetLittersThisYear(), st_EvaluateTerritory(), and st_GiveBirth().

◆ m_gestationcounter

int Rabbit_Female::m_gestationcounter

Counter to record the number of days gestating.

Referenced by GeneralEndocrineDisruptor(), Rabbit_Female(), st_Gestating(), st_GiveBirth(), and st_UpdateBreedingStatus().

◆ m_lactating

bool Rabbit_Female::m_lactating

◆ m_MaxKitsNo

double Rabbit_Female::m_MaxKitsNo = cfg_rabbitmaxkits.value() - cfg_rabbitminkits.value()

The maximum number of kits.

Referenced by CalcLitterSize(), and SetMaxKits().

◆ m_MinKitsNo

double Rabbit_Female::m_MinKitsNo = cfg_rabbitminkits.value()

The minimum number of kits.

Referenced by CalcLitterSize(), and SetMinKits().

◆ m_myLitter

Rabbit_Young* Rabbit_Female::m_myLitter[20]

Holds the current young (for lactation)

Referenced by AddYoung(), OnYoungDeath(), st_Dying(), st_GiveBirth(), st_Lactating(), and Weaned().

◆ m_myLitterSize

int Rabbit_Female::m_myLitterSize

Holds the current litter size.

Referenced by AddYoung(), OnYoungDeath(), Rabbit_Female(), st_Dying(), st_GiveBirth(), st_Lactating(), and Weaned().

◆ m_MyOffspring

int Rabbit_Female::m_MyOffspring

The total number of kits born to her.

Referenced by GetTotalOffspring(), Rabbit_Female(), and st_GiveBirth().

◆ m_MyTotalLitters

int Rabbit_Female::m_MyTotalLitters

The number of litters produced.

Referenced by GetTotalLitters(), Rabbit_Female(), and st_GiveBirth().

◆ m_pregnant

bool Rabbit_Female::m_pregnant

Flag to indicate pregnancy.

Referenced by Rabbit_Female(), st_GiveBirth(), and st_UpdateBreedingStatus().

The documentation for this class was generated from the following files: